package edu.usm.roberge.server;

import java.util.ArrayList;
import java.util.List;

import com.google.gwt.user.server.rpc.RemoteServiceServlet;

import edu.usm.roberge.client.GolfCourseService;
import edu.usm.roberge.server.orbitz.OrbitzCompositeRequest;
import edu.usm.roberge.server.usga.UsgaCourseListRequest;
import edu.usm.roberge.server.weather.WeatherRequest;
import edu.usm.roberge.shared.UsgaGolfCourse;
import edu.usm.roberge.shared.WeatherForecast;

/**
 * The server side implementation of the RPC service.
 */
@SuppressWarnings("serial")
public class GolfCourseServiceImpl extends RemoteServiceServlet implements GolfCourseService {

	public ArrayList<UsgaGolfCourse> getGolfCourses(String city, String state) throws HtmlChangedException {
		UsgaCourseListRequest req = new UsgaCourseListRequest();
		return req.getCoursesByCity(city, state);
	}

	public List<String> getAirplinePrices(String city, String state) throws HtmlChangedException {
		return new OrbitzCompositeRequest().getOrbitzPrices(city);
	}

	public List<WeatherForecast> getWeatherForecast(String city, String state) throws HtmlChangedException {
		return new WeatherRequest().getResultPage(city, state);
	}
}
